<? include("/inc/header.html") {} ?>
<div class="col-lg-12" style="overflow: auto;height: 500px;">
	<div class="panel panel">
		<div class="panel-body pan">
			<div class="form-body pal">
				<div>
					<div class="col-md-9">
						<div class="input-icon">
						<ul class="list-unstyled">
							<li class="pbm">
                                 <input id="minimal-radio-1" tabindex="8" value="2" type="radio" name="minimal-radio" checked="checked" />&nbsp;&nbsp;
                                 <label for="minimal-radio-1">审核通过</label>
                             </li>
							<li class="pbm">
                                 <input id="minimal-radio-2" tabindex="8" value="1" type="radio" name="minimal-radio"/>&nbsp;&nbsp;
                                 <label for="minimal-radio-2">审核不通过</label>
                             </li>
                           </ul>
						</div>
					</div>
				</div>
				<div style="display: none;" id="yy">
					<label for="inputUsername" class="col-md-3 control-label">原因（150字符内）
						<span class='require'>*</span> </label>
					<div class="col-md-9">
							<div class="input-icon">
								<textarea style="width: 100%;" rows="5" id="content"></textarea>
							</div>
					</div>
				</div>
				
				<input type="hidden" id="ids" value="${ids}">
				<input type="hidden" id="type" value="${type}">
				<input type="hidden" id="auditType" value="${auditType}">
			</div>
		</div>
	</div>
</div>
<script>
	
	$(function(){
		$('input:radio[name="minimal-radio"]').on("ifChecked",function(){
			if($('input:radio[name="minimal-radio"]:checked').val()=="1"){
				$("#yy").show();
			}else if($('input:radio[name="minimal-radio"]:checked').val()=="2"){
				$("#yy").hide();
			}
		});
	
	});
function save() {
	audit();
};

function audit(){
	var url='';
	if($("#type").val()=='0'){
		url="./courseAudit.do";
	}else if($("#type").val()=='1'){
		url="./questionAudit.do";
	}else if($("#type").val()=='2'){
		url="./classesOnlineAudit.do";
	}else if($("#type").val()=='3'){
		url="./liveAudit.do";
	}else if($("#type").val()=='4'){
		url="./onlineAudit.do";
	}else if($("#type").val()=='5'){
		url="./advertisementAudit.do";
	}else if($("#type").val()=='6'){
		url="./questionDatabaseAudit.do";
	}
	if($('input:radio[name="minimal-radio"]:checked').val()=="1"){
		if($("#content").val()==''){
			layer.msg("请输入原因");
			return null;
		}
		if($("#content").val().length>150){
			layer.msg("原因:150字以内");
			return null;
		}
	}
	$.ajax({
		type : "post",
		url : url,
		data : {
			"ids" : $("#ids").val(),
			"status":$('input:radio[name="minimal-radio"]:checked').val(),
			"auditType":$("#auditType").val(),
			"content":$("#content").val(),
			"type":"1"
		},
		dataType : "json",
		success : function(data) {
			if(data[0].result=='success'){
				var index = parent.layer.getFrameIndex(window.name);
				window.parent.get();
				parent.layer.msg('提交成功');
				parent.layer.close(index);
			}
			layer.msg(data[0].msg);
		},
		error : function(data) {
			alert("请求失败");
		}
	});
}	
</script>